/*
**  File: General.h
*/
#ifndef GENERALh
#define GENERALh
    
/**************** this part only if THINK_C MacHeaders are not used ****************/

#ifndef _H_MacHeaders                    /* symbol taken from <Mac #includes.c> */

#define true       1
#define false      0       
typedef unsigned char    Boolean;        /* identical to THINK_C */

#endif

/*************** end of conflict with THINK_C MacHeaders *****************/


/* option definitions (possibly) used in different programs;
   ensure unique value - 900 series reserved for MenuFuncts */

#define opt_batch      800   /* batch flag */
#define opt_terseness  801   /* terseness parameter can take integer values
                                from 0 through 9 */


#define size_LINE     81
#define size_FILNAM   81
    
typedef char Card[size_LINE];
typedef char Filnam[size_FILNAM];

typedef struct textbuf Textbuf;
struct textbuf
{
    Card     line;
    Textbuf  *link;
};

#define MIN(x,y)            ( (x) < (y) ? (x) : (y) )
#define MAX(x,y)            ( (x) > (y) ? (x) : (y) )
#define SQUARE(x)           ((x) * (x))
#define CREATE_NEW(type, n) ((type *) calloc((size_t)(n), sizeof(type)))
#define OPENr(fp, nam)      (Boolean)((fp = fopen( nam, "r" ) ) != NULL)
#define NOTOPENr(fp, nam)   (Boolean)((fp = fopen( nam, "r" ) ) == NULL)

#define EQ(a, b)            (Boolean)(strcmp((a), (b)) == 0)
#define NOTEQ(a, b)         (Boolean)(strcmp((a), (b)) != 0)
#define EQn(a, b, n)        (Boolean)(strncmp((a), (b), (n)) == 0)
#define NOTEQn(a, b, n)     (Boolean)(strncmp((a), (b), (n)) != 0)

#define ERROR(m)            printf( " * (in %s): %s\n", fct_name, m )
#define STATUS(m)           printf( "   (in %s: %s)\n", fct_name, m )
#define STATUSm             printf( "   (in %s: %s)\n", fct_name, msg_string )
#define NOMEM(m)            NoMemErrF( fct_name, m )
#define FATAL(m)            FatalErr( fct_name, m )

#endif

